﻿using System.Collections.Generic;
using System.Linq;
using RuTracker.Interface;
using RuTrackerLib.ServiceAttibutes;

namespace RuTracker.WebSite.DbLayer.Repositories
{
    [PerThreadService]
    public class ModificationsRepository : IModificationsRepository
    {
        private readonly DataClassesDataContext _context;

        public ModificationsRepository(IDbLayerSettings settings)
            : this(new DataClassesDataContext(settings.ConnectionString))
        {
            
        }

        protected ModificationsRepository(DataClassesDataContext context)
        {
            _context = context;
        }

        public IList<Modification> LoadModifications()
        {
            return _context.Modifications.OrderBy(m => m.Id).ToList();
        }
    }
}
